var id = 'qRyjLxHd2631'
	var customer = 'EBB0A513D12D812D93A44A24CC5DFF95'
	//var url = 'http://api.kuaidi100.com/api?id=' + id + '&com=' + com + '&nu=' + test1 + '&valicode=1&show=0&muti=1&order=desc'
	var url = 'http://poll.kuaidi100.com/poll/query.do?'
	var request = require('request')
	var md5 = require('md5')
const ExpressCompany = {'中通':'zhongtong','申通':'shentong','顺丰':'shunfeng','圆通':'yuantong','韵达':'yunda'}
module.exports.checkExpress = function checkExpress(order,company,callback){
var param = {}
	param.customer = customer
	param.param = {"com":ExpressCompany[company],"num":order}
	param.param.from = ''
	param.param.to = ''
	param.param.resultv2 = 0
	param.param = JSON.stringify(param.param)

	param.sign = md5(param.param + id + param.customer)
	param.sign = param.sign.toUpperCase()
	    var keys = Object.keys(param).sort(function (a, b) {
    return a.toLowerCase().localeCompare(b.toLowerCase());
		})

	var paramStr = 'customer=' + customer + '&sign=' + param.sign + '&param=' + param.param
	request({
		 	url: url + paramStr,
		 	method: "get",
		 	timeout: 10000,
		 	followRedirect: true,
		 	maxRedirects: 10,
		 	// headers : {
		 	// 'Content-Type': 'application/x-www-form-urlencodedrn',
		 	// 'Content-Length' : Buffer.byteLength(paramStr)
		 	// }
		 },function(error, response, body){
		 	callback(error,body)
		 })

}